<?php
use_stylesheet("/sfAdminThemejRollerPlugin/css/reset.css", "first");
use_stylesheet("/sfAdminThemejRollerPlugin/css/fg.menu.css");
use_stylesheet("/sfAdminThemejRollerPlugin/css/jquery/ui-darkness/jquery-ui.custom.css");
use_stylesheet("/sfAdminThemejRollerPlugin/css/jroller.css");
use_stylesheet("/sfAdminThemejRollerPlugin/css/fg.buttons.css");
use_stylesheet("/sfAdminThemejRollerPlugin/css/ui.selectmenu.css");

//use_javascript("/sfAdminThemejRollerPlugin/js/fg.menu.js");
//use_javascript("/sfAdminThemejRollerPlugin/js/jroller.js");
//use_javascript("/sfAdminThemejRollerPlugin/js/ui.selectmenu.js");
?>
<style type="text/css">.pblabel { position: absolute; width: 100%; padding: 4px; text-align: center; line-height: 1.9em height: 2em }</style>
<div id="sf_admin_container">
    <div class="sf_admin_flashes">
    </div>
    <div id="sf_admin_header">
    </div>
    <div id="sf_admin_content">
        <div class="sf_admin_list ui-grid-table ui-widget ui-corner-all ui-helper-reset ui-helper-clearfix">
            <script type="text/javascript">
                $(function() {
                    $("#progressbar").progressbar({
                        value: 0,
                        change: function(event, ui) {
                            var newVal = $(this).progressbar('option', 'value');
                            $('.pblabel', this).text(newVal + '%');
                        }
                    });
                });
            </script>
            <?php use_helper('jQuery') ?>
            <?php
            echo javascript_tag( jq_remote_function(array(
            'update'    => 'notification',
            'url'       => url_for("import/update"),
            )));
            echo jq_periodically_call_remote(array(
            'frequency' => 5,
            'update'    => 'notification',
            'url'       => url_for("import/update"),
            ));
            echo javascript_tag( jq_remote_function(array(
            'success'   => 'progressbarUpdate(data);',
            'url'       => url_for("import/progressbar"),
            )));
            echo jq_periodically_call_remote(array(
            'frequency' => 5,
            'success'   => 'progressbarUpdate(data);',
            'url'       => url_for("import/progressbar"),
            ));
            echo javascript_tag( "function progressbarUpdate(data) { $(\"#progressbar\").progressbar('value', Math.floor(data*100))};");
            ?>
            <div class="sf_admin_list ui-grid-table ui-widget ui-corner-all ui-helper-reset ui-helper-clearfix">
                <div class="ui-widget-header ui-corner-top padding">
                    <h1>Raid Points Uploader</h1>
                </div>
                <div id="progressbar"><span class="pblabel">0%</span></div>
                <table cellspacing="0">
                </table>
                <div id="notification"></div>
            </div>
        </div>
    </div>

    <div id="sf_admin_footer">
    </div>
</div>
